﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web.UI.HtmlControls;
using _0912276_ChatClient.DTO;


namespace _0912276_ChatClient
{
    public partial class wuc_DangKy : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
         
        }
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Search.aspx");
        }

        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                MemberShip mb = new MemberShip();
                mb.Key = Utils.GenerateIdFromTime();
                mb.FirstName = tbFirstName.Text.Trim();
                mb.LastName = tbLastName.Text.Trim();
                if (RBMale.Checked)
                    mb.Gender = true;
                mb.Gender = false;
                mb.DOBirth = cldDOB.SelectedDate;
                mb.Salary = int.Parse(tbSalary.Text.Trim());
                BO.MemberShipBO.InsertMember(mb);
                Response.Redirect("~/Search.aspx");
            }
            catch (Exception ex)
            {
                Response.Redirect("~/AddMember.aspx");
            }
        }
    }
}